package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.FeedbackMessageMapper;
import com.gc.business.domain.FeedbackMessage;
import com.gc.business.service.IFeedbackMessageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 意见反馈 服务层实现
 * 
 * @author hruiyan
 * @date 2020-12-03
 */
@Slf4j
@Service
public class FeedbackMessageServiceImpl extends ServiceImpl<FeedbackMessageMapper, FeedbackMessage> implements IFeedbackMessageService {

    @Override
    public List<FeedbackMessage> list(FeedbackMessage feedbackMessage){
        LambdaQueryWrapper<FeedbackMessage> wrapper = new LambdaQueryWrapper<>();
        if(feedbackMessage != null){
            if(StringUtils.isNotEmpty(feedbackMessage.getFeedbackId())){
                wrapper.eq(FeedbackMessage::getFeedbackId, feedbackMessage.getFeedbackId());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getCompanyId())){
                wrapper.eq(FeedbackMessage::getCompanyId, feedbackMessage.getCompanyId());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getSubmitterId())){
                wrapper.eq(FeedbackMessage::getSubmitterId, feedbackMessage.getSubmitterId());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getFeedbackContext())){
                wrapper.like(FeedbackMessage::getFeedbackContext, feedbackMessage.getFeedbackContext());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getFeedbackImg())){
                wrapper.eq(FeedbackMessage::getFeedbackImg, feedbackMessage.getFeedbackImg());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getCreateBy())){
                wrapper.eq(FeedbackMessage::getCreateBy, feedbackMessage.getCreateBy());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getCreateTime())){
                wrapper.eq(FeedbackMessage::getCreateTime, feedbackMessage.getCreateTime());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getUpdateBy())){
                wrapper.eq(FeedbackMessage::getUpdateBy, feedbackMessage.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getUpdateTime())){
                wrapper.eq(FeedbackMessage::getUpdateTime, feedbackMessage.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(feedbackMessage.getRemark())){
                wrapper.eq(FeedbackMessage::getRemark, feedbackMessage.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }


    /**
     * 联合查询意见反馈列表
     * @param feedbackMessage
     * @return
     */
    @Override
    public List<FeedbackMessage> selectFeedbackList(FeedbackMessage feedbackMessage){
        return baseMapper.selectFeedbackList(feedbackMessage);
    }

}
